package oop;

class Dog{
  public static int count = 0;  //静态成员变量
  
  public Dog() {	 //构造方法
    count++;
  }
}

public class Test5{
  public static void main(String[] args){
    System.out.println("当前狗的数量是：" + Dog.count);
    Dog d1 = new Dog();
    Dog d2 = new Dog();
    System.out.println("当前狗的数量是：" + Dog.count);
  }
}
